package com.xm_jd.utils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import sun.misc.BASE64Encoder;
/**
 * MD5加密类
 * @author ni
 *
 */
public class MD5 {
	public static String md5(String pwd) throws NoSuchAlgorithmException {
		MessageDigest md;
		try {
			md = MessageDigest.getInstance("md5");
			byte[] bt = md.digest(pwd.getBytes());
			BASE64Encoder encoder = new BASE64Encoder();
			return encoder.encode(bt);
		} catch (Exception e) {
			throw e;
		}
	}
}
